package com.easyaop.test.core.demo;

import com.easyaop.api.around.Call;
import com.easyaop.api.around.CustomCall;
import com.easyaop.api.around.CustomOrigin;
import com.easyaop.api.around.CustomTarget;
import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.RuntimeType;

import java.util.Arrays;

/**
 * @author lipan
 * @since 2025-02-22
 */
public class AroundManger22 {
    @RuntimeType
    public static Object intercept(@CustomOrigin("#t\\##m#d") String sig, @CustomTarget(optional = true) Object target,
                                   @AllArguments Object[] args,
                                   @CustomCall Call call) throws Exception {

        System.out.println("sig22 = " + sig + ", target = " + target + ", args = " + Arrays.deepToString(args) + ", " +
                "call = " + call);
        Object result = call.call();
        System.out.println("result: " + result);

        return result;
    }
}
